home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
301-325
/
disk_319
/
cnewssrc
/
cnews.orig.lzh
/
libv8
/
gethostname.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-06-27
|
340b
|
23 lines
/*
* Uglix gethostname simulation
*/
#include <sys/types.h>
#include <sys/utsname.h>
#define min(a, b) ((a) < (b)? (a): (b))
int
gethostname(buf, size)
char *buf;
int size;
{
struct utsname ugnm;
char *strncpy();
if (uname(&ugnm) < 0)
return -1;
(void) strncpy(buf, ugnm.nodename, min(sizeof ugnm.nodename, size));
return 0;
}